package ru.niir.goodfil.audit.util;

import org.apache.commons.lang.StringUtils;

public class Assert {
    public static void notNull(Object o) {
        if (o == null) throw new IllegalArgumentException();
    }

    public static void notBlank(String s) {
        if (StringUtils.isBlank(s)) throw new IllegalArgumentException();
    }

    public static void isTrue(boolean b) {
        if (!b) throw new IllegalArgumentException();
    }

    public static void isInstanceOf(Object o, Class... klasses) {
        boolean ok = false;
        for (Class klass : klasses) {
            if (klass.isInstance(o)) {
                ok = true;
            }
        }
        if (!ok) throw new IllegalArgumentException();
    }

    public static void exception() {
        throw new AssertionError();
    }
}
